package com.icloud.common.database.enums;

import lombok.Getter;

@Getter
public enum ArticleDiscussScopeEnum {
    ALL("ALL"), // 所有人可评论
    FOLLOWED("FOLLOWED"), // 我关注的可评论
    FOLLOW_ME("FOLLOW_ME"), // 关注我的可评论
    NO("NO"); // 所有人都不可评论

    private final String code;

    ArticleDiscussScopeEnum(String code){
        this.code = code;
    }

    public static ArticleDiscussScopeEnum byCode(String code) {
        for (ArticleDiscussScopeEnum e: ArticleDiscussScopeEnum.values()) {
            if (e.code.equalsIgnoreCase(code)) {
                return e;
            }
        }
        return null;
    }

    public static boolean isAll(String code){
        return ALL.getCode().equalsIgnoreCase(code);
    }
    public static boolean isFollowed(String code){
        return FOLLOWED.getCode().equalsIgnoreCase(code);
    }
    public static boolean isFollowMe(String code){
        return FOLLOW_ME.getCode().equalsIgnoreCase(code);
    }
    public static boolean isNo(String code){
        return NO.getCode().equalsIgnoreCase(code);
    }
}
